package blog;

import blog.beans.Comment;
import blog.model.CommentHelper;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author johdah <info@johandahlberg.com>
 */
@ManagedBean
@SessionScoped
public class CommentController {
    CommentHelper helper;
    
    public CommentController() {
        helper = new CommentHelper();
    }

    public List<Comment> getComments() {
        return helper.getComments();
    }

    public List<Comment> getCommentsByPostId(Integer post_id) {
        return helper.getCommentsByPostId(post_id);
    }
    
    public Integer getCommentsQuantityByPostId(Integer post_id) {
        List<Comment> comments = helper.getCommentsByPostId(post_id);
        return comments.size();
    }
    
    public boolean setComments(Comment comment) {
        return helper.setComments(comment);
    }
}